#@layout()

#define script()
<script>

    $("#sync").on("click", function () {
        ajaxGet("#(CPATH)/admin/permission/syncPermissions",
            function (result) {
                toastr.options.onHidden = function () {
                    location.reload();
                }
                toastr.success(result.message);
            },
            function (result) {
                toastr.success(result.message);
            }
        )
        return false;
    });

</script>
#end


#define content()

    <section class="content-header">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">

                    <div class="row mb-2">
                        <div class="col-sm-12">
                            <h1>
                                用户权限
                                <small data-toggle="tooltip" title="" data-placement="right"
                                       data-trigger="hover"><i class="nav-icon far fa-question-circle"></i></small>
                                <small> 首页 / 用户 / 用户权限</small>
                            </h1>
                        </div>
                    </div>
                </div>

            </div>

        </div><!-- /.container-fluid -->
    </section>





<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="card card-primary card-outline">

            <div class="card-body">

                <div class="btn-group">
                    <a class="btn btn-default #if(type == 1)btn-outline-primary active#end"
                       href="list?type=1">菜单权限</a>
                    <a class="btn btn-default #if(type == 2)btn-outline-primary active#end"
                       href="list?type=2">功能权限</a>
                    <a class="btn btn-default #if(type == 3)btn-outline-primary active#end"
                       href="list?type=3">逻辑权限</a>
                    <a class="btn btn-default #if(type == 4)btn-outline-primary active#end"
                       href="list?type=4">敏感数据权限</a>
                </div>

                <a class="btn btn-outline-primary active" id="sync"
                   href="list?type=1" style="float: right">构建系统权限</a>

                #for(group : groups)
                <h4 class="form-header">
                    #(group.showName ??)
                </h4>

                <div class="form-group row">
                    #for(permission : group.permissions)
                    <div class="col-sm-3 per-item">
                        #(for.count). #(permission.showName ??)
                    </div>
                    #end
                </div>
                #end

            </div><!-- /.card-body -->


        </div>

    </div><!-- /.container-fluid -->
</section>
<!-- /.content -->
#end
